/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package TMS;

/**
 *
 * @author Zachary
 */
public class workout_settings {
    /* Enumerations */
    public enum Workout_Mode {FREERUN, TIMED, INTERVAL,CALORIE};
    public enum Workout_Dificulty {EASY, MEDIUM, HARD};
    /* Treadmill Settings */
    double current_incline, current_speed;
    /* Session Parameters */
    double start_time, target_time;
    double target_calories;
    Workout_Mode workout_mode;
    Workout_Dificulty workout_dificulty;
    
    /* Constructor */
    public workout_settings(){
        current_incline = 0;
        current_speed = 0;
        start_time = 0;
        target_time = 0;
        target_calories = 0;
        workout_mode = workout_mode.FREERUN;
        workout_dificulty = workout_dificulty.EASY;
    }
    /*  */
    public void set_current_speed(double value){
        current_speed = value;
    }
    public void set_current_incline(double value){
        current_incline = value;
    }
    public void set_start_time(double value){
        start_time = value;
    }
    public void set_target_time(double value){
        target_time = value;
    }
    public void set_target_calories(double value){
        target_calories = value;
    }
    public double get_current_speed(){
        return current_speed;
    }
    public double get_current_incline(){
        return current_incline;
    }
    public double get_start_time(){
        return start_time;
    }
    public double get_target_time(){
        return target_time;
    }
    public double get_target_calories(){
        return target_calories;
    }
    //
    public void set_Mode(Workout_Mode mode, Workout_Dificulty dificulty){
        workout_mode = mode;
        if (mode == Workout_Mode.INTERVAL){
            workout_dificulty = dificulty;
            /* Set minimum time for interval mode to 30 minutes */
            if (target_time < 1800) target_time = 1800;
        }
    }
    public boolean adjustSettings(double time_elapsed, double calories_burned){
        double  new_speed = 0;
        double new_incline = 0;
        switch (workout_mode){
            case FREERUN:
                /* Free-Run: do not modify settings */
                return false;
            case TIMED:
                /* Timed Run: do not modify settings */
                return false;                
            case INTERVAL:
                return false;                
            case CALORIE:
                return false;
        }
        return false;
    }
    public boolean workout_done(double time_elapsed, double calories_burned){
        switch (workout_mode){
            case FREERUN:
                return false;
                //break;
            case TIMED:
                if (time_elapsed >= target_time) return true;
                break;
            case INTERVAL:
                return false;
                //break;
            case CALORIE:
                if (calories_burned >= target_calories) return true;                
                break;
        }
        return false;
    }
    public String current_mode(){
        if (workout_mode == Workout_Mode.INTERVAL){
            return workout_mode.toString() + "\tDificulty: " + workout_dificulty.toString();
        }
        return workout_mode.toString();
    }
}
